<?php
include 'secure/core.php';
if(isset($_POST['submit'])){
$ret_val = $admin->is_loginValid(mysql_real_escape_string($_POST['user_name']),mysql_real_escape_string($_POST['password']));
	if($ret_val == -1){		
		header( 'Location: login.php?msg=1' ) ;	
		exit();
	}
	else{		
		
		$_SESSION['id'] = $ret_val['id'];
		$_SESSION['admin'] = $ret_val['username'];	
		
		header( 'Location: dashboard.php' ) ;	
		exit();	
	}
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
	<base >
	<meta http-equiv="Content-Type" content="text/html;charset=utf-8" /> 
	<title>Administration - Login</title>
	
	<style type="text/css">
		@import url("css/style.css");
		@import url("css/forms.css");
		@import url("css/forms-btn.css");
		@import url("css/menu.css");
		@import url('css/style_text.css');
		@import url("css/datatables.css");
		@import url("css/fullcalendar.css");
		@import url("css/pirebox.css");
		@import url("css/modalwindow.css");
		@import url("css/statics.css");
		@import url("css/tabs-toggle.css");
		@import url("css/system-message.css");
		@import url("css/tooltip.css");
		@import url("css/wizard.css");
		@import url("css/handheld.css");
		@import url("css/custom.css");
	</style>
	<!--[if lte IE 8]>
		<script type="text/javascript" src="js/excanvas.min.js"></script>
	<![endif]-->
	<script type="text/javascript" src="js/jquery-1.7.1.min.js"></script>
	<script type="text/javascript" src="js/jquery.backgroundPosition.js"></script>
	<script type="text/javascript" src="js/jquery.placeholder.min.js"></script>
	<script type="text/javascript" src="js/jquery.ui.1.8.17.js"></script>
	<script type="text/javascript" src="js/jquery.ui.select.js"></script>
	<script type="text/javascript" src="js/jquery.ui.spinner.js"></script>
	<script type="text/javascript" src="js/superfish.js"></script>
	<script type="text/javascript" src="js/supersubs.js"></script>
	<script type="text/javascript" src="js/jquery.datatables.js"></script>
	<script type="text/javascript" src="js/fullcalendar.min.js"></script>
	<script type="text/javascript" src="js/jquery.smartwizard-2.0.min.js"></script>
	<script type="text/javascript" src="js/pirobox.extended.min.js"></script>
	<script type="text/javascript" src="js/jquery.tipsy.js"></script>
	<script type="text/javascript" src="js/jquery.elastic.source.js"></script>
	<script type="text/javascript" src="js/jquery.jBreadCrumb.1.1.js"></script>
	<script type="text/javascript" src="js/jquery.customInput.js"></script>
	<script type="text/javascript" src="js/jquery.validate.min.js"></script>
	<script type="text/javascript" src="js/jquery.metadata.js"></script>
	<script type="text/javascript" src="js/jquery.filestyle.mini.js"></script>
	<script type="text/javascript" src="js/jquery.filter.input.js"></script>
	<script type="text/javascript" src="js/jquery.flot.js"></script>
	<script type="text/javascript" src="js/jquery.flot.pie.min.js"></script>
	<script type="text/javascript" src="js/jquery.flot.resize.min.js"></script>
	<script type="text/javascript" src="js/jquery.graphtable-0.2.js"></script>
	<script type="text/javascript" src="js/jquery.wysiwyg.js"></script>
	<script type="text/javascript" src="js/controls/wysiwyg.image.js"></script>
	<script type="text/javascript" src="js/controls/wysiwyg.link.js"></script>
	<script type="text/javascript" src="js/controls/wysiwyg.table.js"></script>
	<script type="text/javascript" src="js/plugins/wysiwyg.rmFormat.js"></script>
	<script type="text/javascript" src="js/costum.js"></script>
	<script type="text/javascript" src="js/thickbox.js"></script>
        <script type="text/javascript" src="js/ajax.js"></script>
	<link href="css/thickbox.css" rel="stylesheet" type="text/css" />
	
</head>
<div id="wrapper" class="login">
	
	<div class="box">
		<div class="title">
			Please login
			<span class="hide"></span>
		</div>
		<div class="content">
		        <?php if($_GET['msg'] == '1') { ?>
			<div class="message inner red">
				<span><b>Error</b>: Username or Password is incorrect.</span>
			</div>
			<?php } ?>
			<form action="login.php" method="POST">
				<div class="row">
					<label>Username</label>
					<div class="right"><input type="text" name="user_name" value=""></div>
				</div>
				<div class="row">
					<label>Password</label>
					<div class="right"><input type="password" name="password" value=""></div>
				</div>
				<div class="row">
					<div class="right">
						<button type="submit" name="submit"><span>Submit</span></button>
					</div>
				</div>
			</form>
		</div>
	</div>
	
</div>